from django.db import models
from dingxiang_doctor.utils.basemodels import BaseModel
from user.models import User
from doctor.models import Doctor

# Create your models here.
class Order1(BaseModel):
    status_choice = {
        (0, "未支付"),
        (1, "已支付"),
        (2, "已取消"),
        (3, "已超时"),
    }
    id = models.CharField(max_length=200, primary_key=True, verbose_name="订单id")
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="用户")
    doctor = models.ForeignKey(Doctor, on_delete=models.CASCADE, verbose_name="医生")
    status = models.SmallIntegerField(choices=status_choice, default=0, verbose_name="订单状态")
    price = models.IntegerField(default=0, verbose_name="价格")
    times = models.IntegerField(default=1, verbose_name="问询次数")
    duration = models.IntegerField(default=1, verbose_name="持续时间")
    detail = models.TextField(null=True, verbose_name="用户基本信息")

    class Meta:
        db_table = "order1"
        verbose_name_plural = "订单"

class Order2(BaseModel):
    status_choice = {
        (0, "未支付"),
        (1, "已支付"),
        (2, "已取消"),
        (3, "已超时"),
    }
    id = models.CharField(max_length=200, primary_key=True, verbose_name="订单id")
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="用户")
    doctor = models.ForeignKey(Doctor, on_delete=models.CASCADE, verbose_name="医生")
    status = models.SmallIntegerField(choices=status_choice, default=0, verbose_name="订单状态")
    price = models.IntegerField(default=0, verbose_name="价格")
    times = models.IntegerField(default=1, verbose_name="问询次数")
    duration = models.IntegerField(default=1, verbose_name="持续时间")
    detail = models.TextField(null=True, verbose_name="用户基本信息")

    class Meta:
        db_table = "order2"
        verbose_name_plural = "订单"

class Order3(BaseModel):
    status_choice = {
        (0, "未支付"),
        (1, "已支付"),
        (2, "已取消"),
        (3, "已超时"),
    }
    id = models.CharField(max_length=200, primary_key=True, verbose_name="订单id")
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="用户")
    doctor = models.ForeignKey(Doctor, on_delete=models.CASCADE, verbose_name="医生")
    status = models.SmallIntegerField(choices=status_choice, default=0, verbose_name="订单状态")
    price = models.IntegerField(default=0, verbose_name="价格")
    times = models.IntegerField(default=1, verbose_name="问询次数")
    duration = models.IntegerField(default=1, verbose_name="持续时间")
    detail = models.TextField(null=True, verbose_name="用户基本信息")

    class Meta:
        db_table = "order3"
        verbose_name_plural = "订单"
